package jdbc_util;

import org.apache.commons.dbutils.DbUtils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class FirstApp {
    //为了更加方便看到结果，这里直接使用这种方式连接数据库
    static final String driver = "com.mysql.cj.jdbc.Driver";
    static final String url = "jdbc:mysql://localhost:3306/shop?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8";
    static final String user = "root";
    static final String passwd = "123456";
    public static Connection getConn() throws SQLException {
        DbUtils.loadDriver(driver);
        return DriverManager.getConnection(url, user, passwd);
    }
}